#define  _CRT_SECURE_NO_WARNINGS
#include<iostream>
using namespace std;

int main()
{
    long long  int f[1000001];
    f[0] = 7;
    f[1] = 11;
    for (int i = 2; i <= 1000000; i++)
    {
        f[i] = (f[i - 1] + f[i - 2]) % 3;
    }
    int n;
    while (cin >> n)
    {
        if (f[n] == 0) 
            cout << "Yes" << endl;
        else 
            cout << "No" << endl;
    }
    return 0;
}